package com.imooc.reader.portal.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.imooc.reader.portal.entity.Category;
import com.imooc.reader.portal.mapper.CategoryMapper;
import com.imooc.reader.portal.service.CategoryService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public List<Category> selectAll() {
        QueryWrapper wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("category_id");
        List<Category> list = categoryMapper.selectList(wrapper);
        for (Category category : list) {
            System.out.println(category);
        }
        return list;
    }
}
